package  
{
	import org.flixel.*;
	public class ScoreUI extends FlxSprite
	{
		[Embed(source = "../assets/DiamondScore.png")] public const diamondImage:Class;
		[Embed(source = "../assets/DiamondBack.png")] public const diamondImageBack:Class;
		
		private var state:PlayState;
		
		private var t1d1:FlxSprite;
		private var t1d2:FlxSprite;
		private var t1d3:FlxSprite;
		private var t2d1:FlxSprite;
		private var t2d2:FlxSprite;
		private var t2d3:FlxSprite;
		
		public function ScoreUI(state:PlayState) 
		{
			this.state = state;
			
			var t1d1back:FlxSprite = new FlxSprite(10, 10, diamondImageBack);
			var t1d2back:FlxSprite = new FlxSprite(10, 50, diamondImageBack);			
			var t1d3back:FlxSprite = new FlxSprite(10, 90, diamondImageBack);			
			var t2d1back:FlxSprite = new FlxSprite(FlxG.width - 40, 10, diamondImageBack);
			var t2d2back:FlxSprite = new FlxSprite(FlxG.width - 40, 50, diamondImageBack);			
			var t2d3back:FlxSprite = new FlxSprite(FlxG.width - 40, 90, diamondImageBack);			
						
								
			Registry.groupUI.add(t1d1back);
			Registry.groupUI.add(t1d2back);
			Registry.groupUI.add(t1d3back);
			Registry.groupUI.add(t2d1back);
			Registry.groupUI.add(t2d2back);
			Registry.groupUI.add(t2d3back);
			
			
			t1d1 = new FlxSprite(10, 10, diamondImage);
			t1d2 = new FlxSprite(10, 50, diamondImage);
			t1d3 = new FlxSprite(10, 90, diamondImage);
			t2d1 = new FlxSprite(FlxG.width - 40, 10, diamondImage);
			t2d2 = new FlxSprite(FlxG.width - 40, 50, diamondImage);
			t2d3 = new FlxSprite(FlxG.width - 40, 90, diamondImage);
			
			t1d1.color = t1d2.color = t1d3.color = (FlxG.state as PlayState).baseTeam1.color;
			t2d1.color = t2d2.color = t2d3.color = (FlxG.state as PlayState).baseTeam2.color;
			
			Registry.groupUI.add(t1d1);
			Registry.groupUI.add(t1d2);
			Registry.groupUI.add(t1d3);
			Registry.groupUI.add(t2d1);
			Registry.groupUI.add(t2d2);
			Registry.groupUI.add(t2d3);
			alpha = 0;
		}
		
		override public function update():void 
		{
			
		}
		
		public function UpdateOnce():void
		{
			
			t1d1.alpha = t1d2.alpha = t1d3.alpha = 0.3;
			t2d1.alpha = t2d2.alpha = t2d3.alpha = 0.3;
			
			switch(Registry.scoreTeam1)
			{
				case 3:
					t1d3.alpha = 1;
				case 2:
					t1d2.alpha = 1;
				case 1:
					t1d1.alpha = 1;
			}

			switch(Registry.scoreTeam2)
			{
				case 3:
					t2d3.alpha = 1;
				case 2:
					t2d2.alpha = 1;
				case 1:
					t2d1.alpha = 1;
			}			
			
		}
	}
}